//
//  IWHWebview.h
//  YiYuanGou
//
//  Created by zhangtongle on 2017/5/5.
//  Copyright © 2017年 同乐1234521. All rights reserved.
//

#import <UIKit/UIKit.h>

#import <JavaScriptCore/JavaScriptCore.h>

@protocol JSObjectDelegate <JSExport>
- (void)setPageInfo:(NSString *)jsonStr;
- (void)openWebView:(NSString *)jsonStr;
- (void)closeWebView:(NSString *)jsonStr;
- (void)getDeviceInfo;
- (void)getAppInfo;
- (void)getToken;
@end


@protocol IWHWebViewDelegate <NSObject>

- (void)IWHWebViewDidClose;
- (void)IWHShowAlertView:(UIAlertController *)alertViewVC animated:(BOOL)animated;
- (void)IWHOpenNewWindow:(NSString *)urlStr;
- (void)IWHMessageSomeone:(NSDictionary *)result;

@end

@interface IWHWebview : UIView <JSObjectDelegate>

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *navHeight;
@property (weak, nonatomic) IBOutlet UIButton *navBackBtn;
@property (weak, nonatomic) IBOutlet UILabel *navTitleL;
@property (weak, nonatomic) IBOutlet UIButton *navShareBtn;

@property (assign, readonly, nonatomic) BOOL isMainWebView;
@property (nonatomic, weak) id<IWHWebViewDelegate>iwhDelegate;


- (void)navHidden:(BOOL)hidden;
- (void)setMainWebView;

/**
 显示加载进度条
 */
- (void)enableNavigationProgress;

+ (IWHWebview *)IWHWebview:(CGRect)frame;
- (void)loadRequest:(NSString *)urlStr;
@end
